fix(cold-sql): pool starvation and query inefficiencies#45
Open
fix(cold-sql): pool starvation and query inefficiencies#45
Conversation
prestwich
added a commit
to init4tech/node-components
that referenced
this pull request
Apr 3, 2026
Update all signet-storage family crates (signet-storage, signet-cold, signet-hot, signet-hot-mdbx, signet-cold-mdbx, signet-storage-types) to 0.7 from init4tech/storage#45. Bump workspace version to 0.17.1. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2 tasks
- Add per-backend pool defaults and SqlConnector builder - Add safety checks to integer conversions - Replace get_logs COUNT+SELECT with single LIMIT query - Consolidate get_receipt and batch drain_above - Bump workspace version to 0.7.0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
c4a8b9e to
b513020
Compare
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes ENG-2124
SqlColdBackend::connect()created a single-connection pool for all backends including PostgreSQL, serializing 64 concurrent readers + 8 stream producers. Now uses per-backend defaults (SQLite: 1, PostgreSQL: 10) withacquire_timeout(5s). AddsPoolOverridesstruct andSqlConnectorbuilder for production tunability.get_logsoptimization: Replace COUNT(*) + SELECT with single LIMIT query — faster in both under-limit and over-limit cases.get_receiptconsolidation: Merge 5 sequential queries (header, receipt+tx, logs, prior gas) into 2-3 via combined JOIN with COALESCE subquery.drain_abovebatch override: Replace default N+1 implementation (3N+7 queries) with batched single-transaction approach (9 queries regardless of block count).to_i64/from_i64, checkedtx_typeconversion throughout.Test plan
cargo t -p signet-cold-sql --all-features— SQLite + PG conformance passingcargo clippy -p signet-cold-sql --all-features --all-targets— cleancargo clippy -p signet-cold-sql --no-default-features --all-targets— cleancargo clippy --workspace --all-features --all-targets— cleancargo +nightly fmt— clean./scripts/test-postgres.sh— PostgreSQL conformance against real database🤖 Generated with Claude Code